package com.android.djlmapp.http;

import android.text.TextUtils;
import android.util.Log;

import com.android.djlmapp.application.MyApplication;
import com.android.djlmapp.tools.global.PrefUtils;
import com.lzy.okgo.callback.AbsCallback;
import com.lzy.okgo.callback.StringCallback;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import static com.android.djlmapp.activity.kaika.SelectNumActivity.PAGE_DATA_URL_KEY;
import static com.android.djlmapp.http.GlobalUrls.READ_MSG_REQUEST;
import static com.android.djlmapp.http.GlobalUrls.UPLOAD_IMG;

/**
 * Created by yucheng on 2018/3/27.
 */

public class HttpTools {

    /**
     * 登录
     *
     * @param Network
     * @param Phone_num
     * @param Push_id
     * @param phone_brand
     * @param phone_gps
     * @param phone_imei
     * @param phone_os
     * @param phone_type
     * @param type
     * @param user_name
     * @param user_password
     * @param mStringCallback
     */
    public void login(String Network, String Phone_num, String Push_id,
                      String phone_brand, String phone_gps, String phone_imei,
                      String phone_os, String phone_type, String type,
                      String user_name, String user_password, AbsCallback<String> mStringCallback) {


        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("Network", Network);
        mParams.put("Phone_num", Phone_num);
        mParams.put("Push_id", Push_id);
        mParams.put("phone_brand", phone_brand);
        mParams.put("phone_gps", phone_gps);
        mParams.put("phone_imei", phone_imei);
        mParams.put("phone_os", phone_os);
        mParams.put("phone_type", phone_type);
        mParams.put("type", type);
        mParams.put("user_name", user_name);
        mParams.put("user_password", user_password);

        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.LOGIN_URL);
    }

    /**
     * 订单数据
     *
     * @param orderType 订单类型
     *                  0 开卡订单
     *                  1 话费充值订单
     *                  2 流量充值订单
     *                  3 宽带订单
     *                  4 终端订单
     *                  5 Q币充值
     *                  6 游戏充值
     *                  8 电信宽带  8以及8之后的 因为是电信的订单 店家联盟暂无用到
     *                  9 橙分期
     *                  10 智能组网
     *                  11 惠民业务
     * @param pageSize  页数
     */
    public void requestOrder(String orderType, String pageSize, AbsCallback<String> stringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        String requestUrl;
        if (!TextUtils.isEmpty(orderType)) {
            mParams.put("order_type", orderType);
            requestUrl = GlobalUrls.ORDER_LIST_URL;
        } else {
            requestUrl = GlobalUrls.ORDER_ALL_LIST_URL;
        }
        mParams.put("p", pageSize);
        new HttpManage().postStringRequest(mParams, stringCallback, requestUrl);
    }

    /**
     * 搜索订单
     *
     * @param orderType      订单类型
     * @param searchContent  搜索类型
     * @param stringCallback
     */
    public void searchOrderData(String orderType, String searchContent, AbsCallback<String> stringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        String requestUrl;
        if (!TextUtils.isEmpty(orderType)) {
            requestUrl = GlobalUrls.SEARCH_ORDER_URL;
            mParams.put("order_type", orderType);
        } else {
            requestUrl = GlobalUrls.ORDER_ALL_LIST_URL;
        }
        mParams.put("order_sn", searchContent);
        new HttpManage().postStringRequest(mParams, stringCallback, requestUrl);
    }

    /**
     * 获取首页数据
     *
     * @param mStringCallback
     */
    public void getHomeData(AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_HOME_DATA);
    }

    /**
     * 获取读卡相关数据
     *
     * @param mStringCallback
     */
    public void getReadCardData(AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_CARD_DATA);
    }

    /**
     * 获取开卡,宽带首页卡相关数据
     *
     * @param mStringCallback
     */
    public void getKaiKaHomeData(String url, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        new HttpManage().postStringRequest(mParams, mStringCallback, url);
    }

    /**
     * 获取店家联盟读卡数据
     *
     * @param mStringCallback
     */
    public void getDjlmReadCardData(AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_DJLM_IP);
    }

    /**
     * @param add_para
     * @param duan            号码段
     * @param iccid_no
     * @param is_heyue_id
     * @param jituan_no       集团编码
     * @param phonenum        搜索字段
     * @param price           靓号费
     * @param r_type          靓号类型
     * @param type            号码类型
     * @param mStringCallback
     * @param otherParams     其他额外的请求参数
     */
    public void getSelectNumData(String yeWuType, String fkblNum, String add_para, String iccid_no, String is_heyue_id,
                                 String jituan_no, String phonenum, String type, String duan,
                                 String price, String r_type, AbsCallback<String> mStringCallback, Map<String, String> otherParams) {
        Log.e("项目异常", "------yeWuType------" + yeWuType);
        HashMap<String, String> mParams = new HashMap<>();
        Map<String, String> mOtherParams = new HashMap<>();
        mOtherParams.putAll(otherParams);
        mParams.put("yewu_type", yeWuType);
        mParams.put("main_phone", fkblNum);
        mParams.put("add_para", add_para);
        mParams.put("duan", duan);
        mParams.put("iccid_no", iccid_no);
        mParams.put("is_heyue_id", is_heyue_id);
        mParams.put("jituan_no", jituan_no);
        mParams.put("phonenum", phonenum);
        mParams.put("price", price);
        mParams.put("r_type", r_type);
        mParams.put("icp_id", "1");
        mParams.put("type", type);
        String requestUrl = mOtherParams.remove(PAGE_DATA_URL_KEY);
        if (mOtherParams.size() > 0) {
            mParams.putAll(mOtherParams);
        }
        new HttpManage().postStringRequest(mParams, mStringCallback, requestUrl);
    }

    /**
     * @param add_para
     * @param iccid_no
     * @param is_heyue_id     合约机
     * @param jituan_no       集团编码
     * @param phone           选择的号码
     * @param mStringCallback
     */
    public void getSelectTcData(String yeWuType, String fkblNum, String add_para, String iccid_no, String is_heyue_id,
                                String jituan_no, String phone, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();

        mParams.put("yewu_type", yeWuType);
        mParams.put("main_phone", fkblNum);
        mParams.put("add_para", add_para);
        mParams.put("icp_id", "1");
        mParams.put("iccid_no", iccid_no);
        mParams.put("is_heyue_id", is_heyue_id);
        mParams.put("jituan_no", jituan_no);
        mParams.put("phone", phone);

        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_TC);
    }

    /**
     * @param isBaiKa         是否白卡(1是),宽带智慧沃家获取SIM卡需要
     * @param add_para        开卡
     * @param keyvalue        搜索字段
     * @param type            开卡
     * @param mStringCallback
     */
    public void getSimNum(String isBaiKa, String mainPhone, String add_para, String keyvalue, String type,
                          AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();

        mParams.put("is_baika", isBaiKa);
        mParams.put("main_phone", mainPhone);
        mParams.put("add_para", add_para);
        mParams.put("icp_id", "1");
        mParams.put("keyvalue", keyvalue);
        mParams.put("yewu_type", type);

        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_SIM);
    }

    /**
     * @param photLists
     * @param add_para
     * @param buyer_mobile    // 用户联系号码
     * @param card_reader     // 阅读器类型
     * @param face_image      //返回的对比照  连接
     * @param face_ok         //人脸识别结果
     * @param face_token      // 人脸识别返回的数据
     * @param gps_e           //经度
     * @param gps_n           // 纬度
     * @param iccid_no        // ICCID编号
     * @param id              // 号码编码--号码列表
     * @param imei_no         // IMEI编号                 选号认证
     * @param is_heyue_user   // 合约机ID
     * @param jituan_no       //集团编码
     * @param run_idcard      //经办人身份证号
     * @param spec_id         // 套餐编号
     * @param type_id         // 生效类型ID
     * @param user_card       // 用户身份证号
     * @param user_name       // 用户姓名
     * @param user_sign       // 用户电子签名链接
     * @param pay_pwd         // 支付密码
     * @param touch_pwd
     * @param touch_num
     * @param mStringCallback
     */
    public void submitKaiKa(String hzTime, String idcardType, String hzSex, String hzAddress, String userName, int photLists, String fkblNum, String add_para, String buyer_mobile, String card_reader,
                            String face_image, String face_ok, String face_token, String gps_e,
                            String gps_n, String iccid_no, String id, String imei_no,
                            String is_heyue_user, String jituan_no, String run_idcard, String spec_id,
                            String type_id, String user_card, String user_name, String user_sign,
                            String pay_pwd, String touch_pwd, String touch_num, String yewuType,
                            AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();

        // 实名认证所需字段
        mParams.put("add_para", add_para);
        mParams.put("main_phone", fkblNum);
        mParams.put("iccid_no", iccid_no);
        mParams.put("imei_no", imei_no);
        mParams.put("is_heyue_user", is_heyue_user);
        mParams.put("jituan_no", jituan_no);
        mParams.put("spec_id", spec_id);
        mParams.put("type_id", type_id);
        mParams.put("user_img", "new_idcard");
        mParams.put("user_time", "1");

        // 成卡激活所需字段
        mParams.put("is_app", "1");


        // 护照所用
        mParams.put("idcard_to", hzTime); // 证件有效时间
        mParams.put("idcard_type", idcardType); // 护照权限
        mParams.put("staff_name", hzSex); // 护照性别
        mParams.put("address", hzAddress); // 护照地址
        mParams.put("real_name", userName); // 护照地址


        mParams.put("iccid_face", PrefUtils.getString("FACE_HUZHAO", "")); // 护照正面照
        mParams.put("iccid_inverse", PrefUtils.getString("BACK_HUZHAO", "")); // 护照背面照


        // 公用字段
        mParams.put("buyer_mobile", buyer_mobile);
        mParams.put("card_reader", card_reader);
        mParams.put("face_image ", face_image);
        mParams.put("face_ok", face_ok);
        mParams.put("face_token", face_token);
        mParams.put("gps_e", gps_e);
        mParams.put("gps_n", gps_n);
        mParams.put("id", id);
        mParams.put("run_idcard", run_idcard);
        mParams.put("user_card", user_card);
        mParams.put("user_name", user_name);
        mParams.put("user_sign", user_sign);
        mParams.put("yewu_type", yewuType);
        mParams.put("pay_pwd", pay_pwd);
        mParams.put("touch_pwd", touch_pwd);
        mParams.put("touch_num", touch_num);

        // 用户上传的照片(正,反,手持,公安)
        for (int i = 0; i < photLists; i++) {
            String key = PrefUtils.getString("key" + i, "");
            String value = PrefUtils.getString("value" + i, "");
            Log.e("项目异常", "key--value" + key + "-----" + value);
            mParams.put(key, value);
        }

        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.COMIT_PAY);
    }

    /**
     * 获取系统消息
     *
     * @param stringCallback
     */
    public void getSystemMsgList(AbsCallback<String> stringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("push_id", MyApplication.getInstance().getRegistrationId());
        new HttpManage().postStringRequest(mParams, stringCallback, GlobalUrls.QUERY_SYSTEM_MSG);
    }

    /**
     * 获取站内信
     *
     * @param stringCallback
     */
    public void getInstationMsgList(AbsCallback<String> stringCallback) {
        new HttpManage().postStringRequest(new HashMap<>(), stringCallback, GlobalUrls.MSG_ZNX);
    }

    /**
     * 获取站内信消息详情
     *
     * @param msgID
     * @param stringAbsCallback
     */
    public void getInstationMsgDetail(String msgID, AbsCallback<String> stringAbsCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("msg_id", msgID);
        new HttpManage().postStringRequest(mParams, stringAbsCallback, GlobalUrls.MSG_DETAIL);
    }

    public void getSystemMsgDetail(String msgID, AbsCallback<String> stringAbsCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("id", msgID);
        new HttpManage().postStringRequest(mParams, stringAbsCallback, READ_MSG_REQUEST);
    }

    public void getLastMsg(AbsCallback<String> stringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("push_id", MyApplication.getInstance().getRegistrationId());
        new HttpManage().postStringRequest(mParams, stringCallback, GlobalUrls.LAST_MSG_CONTENT);
    }

    public void getJiTuanNumOrGuHuaNum(String url, String keyvalue, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();

        mParams.put("keyvalue", keyvalue);
        new HttpManage().postStringRequest(mParams, mStringCallback, url);
    }

    /**
     * 上传单张图片
     *
     * @param file
     */
    public void upLoadImg(File file, AbsCallback<String> stringCallback) {
        HashMap<String, File> mFileParams = new HashMap<>();
        mFileParams.put("image", file);
        new HttpManage().postFileRequest(new HashMap<>(), mFileParams, stringCallback, UPLOAD_IMG);
    }

    /**
     * 我的主页
     **/
    public void getMyData(AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_SELFMSG);
    }

    /**
     * 上级代理/经理
     **/
    public void getSJ(AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_KHJL);
    }

    /**
     * 上传签名照片
     *
     * @param mUrl
     * @param file
     * @param mStringCallback
     */
    public void getSingPhoto(String mUrl, File file, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap();
        HashMap<String, File> mFileParams = new HashMap();
        mFileParams.put("image", file);
        new HttpManage().postFileRequest(mParams, mFileParams, mStringCallback, mUrl);
    }

    /**
     * 上传读卡数据
     *
     * @param subData        读卡数据
     * @param chuanma        串码
     * @param stringCallback
     */
    public void submitIdCard(String subData, String chuanma, AbsCallback<String> stringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("card_reader", chuanma);
        mParams.put("data", subData);
        new HttpManage().postStringRequest(mParams, stringCallback, GlobalUrls.IDCARD_URL);
    }

    /**
     * 获取实名认证拍照信息
     *
     * @param iskuandai
     * @param selectPhoneNum
     * @param specid
     * @param cardNum
     * @param mStringCallback
     */
    public void getPhotoMsg(boolean iskuandai, String selectPhoneNum, String specid, String cardNum,
                            AbsCallback<String> mStringCallback) {

        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("icp_id", "1");
        mParams.put("phonenum", selectPhoneNum);
        mParams.put("spec_id", specid);
        mParams.put("user_card", cardNum);

        if (iskuandai) {
            mParams.put("yewu", "kd");
        } else {
            mParams.put("yewu", "kk");
        }

        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_PHOTO_MSG);
    }

    public void ShiMingDuiBi(String mIDCardNum, String cardPhotoUrl, String photoUrl,
                             String mobile, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("idcard", mIDCardNum);
        mParams.put("idcard_photo", cardPhotoUrl);
        mParams.put("real_photo", photoUrl);
        mParams.put("tel", mobile);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.BD_SMRZ);

    }

    /**
     * 获取活体检测数据
     *
     * @param specid
     * @param mStringCallback
     */
    public void getFaceData(String specid, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("spec_id", specid);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.FACE_NUMBER);
    }

    /**
     * 自定义相机照片上传对比
     *
     * @param mZhengPhoto
     * @param filename
     * @param mStringCallback
     */
    public void faceDuiBi(String mZhengPhoto, String filename, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("img_a", mZhengPhoto);
        mParams.put("img_b", filename);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.FACE_URL);
    }

    /**
     * 获取手动拍照身份信息
     *
     * @param backUrl
     * @param faceUrl
     * @param mStringCallback
     */
    public void getCardInfo(String backUrl, String faceUrl, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("back_card", backUrl); // 反面照
        mParams.put("face_card", faceUrl); // 正面照
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_CARD_INFO);
    }

    /**
     * 派单数据交互
     *
     * @param url
     * @param isAction
     * @param isLocation
     * @param latitude
     * @param longitude
     * @param location
     * @param mStringCallback
     */
    public void paiDanDate(String url, boolean isAction, boolean isLocation, String latitude,
                           String longitude, String location, AbsCallback<String> mStringCallback) {

        Log.e("派单数据交互", "------1------" + url);
        Log.e("派单数据交互", "------1------" + isAction);
        Log.e("派单数据交互", "------1------" + isLocation);
        Log.e("派单数据交互", "------1------" + latitude);
        Log.e("派单数据交互", "------1------" + longitude);
        Log.e("派单数据交互", "------1------" + location);
        HashMap<String, String> mParams = new HashMap<>();

        if (isLocation) {
            mParams.put("Latitude", latitude);
            mParams.put("Longitude", longitude);
        }
        if (isAction) {
            mParams.put("action", location);
        }
        new HttpManage().postStringRequest(mParams, mStringCallback, url);
    }

    /**
     * 微信生成预支付交易单
     *
     * @param money
     * @param wxpay_app
     * @param isApp
     * @param mStringCallback
     */
    public void weiXinPay(String money, String wxpay_app, String isApp, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("money", money);
        mParams.put("bank_code", wxpay_app);
        mParams.put("is_app", isApp);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.WX_PAY);
    }

    /**
     * 退出登录
     **/
    public void exit(AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.OUT_LOGIN_URL);
    }

    /**
     * 获取验证码
     **/
    public void getCode(String pNum, String type, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("mobile", pNum);
        mParams.put("type", type);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_SMS);
    }

    /**
     * 验证验证码
     **/
    public void checkCode(String pNum, String code, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("mobile", pNum);
        mParams.put("code", code);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.SMS_CODE);
    }

    /**
     * 更换手机号
     **/
    public void changeNum(String pNum, String code, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("mobile", pNum);
        mParams.put("code", code);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.CHANGE_PHONE);
    }

    /**
     * 如果不是验证就传 code
     *
     * @param mUrl
     * @param isYanZheng
     * @param keyvalue
     * @param bd_mobile
     * @param mStringCallback
     */
    public void shiMingMsgCode(String mUrl, boolean isYanZheng, String keyvalue, String bd_mobile,
                               AbsCallback<String> mStringCallback) {

        HashMap<String, String> mParams = new HashMap<>();
        if (isYanZheng) {
            mParams.put("code", keyvalue);
        }
        mParams.put("mobile", bd_mobile);
        new HttpManage().postStringRequest(mParams, mStringCallback, mUrl);
    }

    /**
     * 头像上传
     *
     * @param mStringCallback
     */
    public void uploadHeadImg(File file, AbsCallback<String> mStringCallback) {
        HashMap<String, File> mParams = new HashMap<>();
        mParams.put("user_img", file);
        new HttpManage().postFileRequest(new HashMap<>(), mParams, mStringCallback, GlobalUrls.SUBBMIT_PHOTO);
    }

    /**
     * 上传头像地址
     *
     * @param url
     * @param mStringCallback
     */
    public void uploadHeadUrl(String url, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("user_img", url);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.CHANGE_PHOTO);
    }

    /**
     * 密码修改
     *
     * @param mStringCallback
     */
    public void editPwd(String old_pwd, String new_pwd, String type, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("old_pwd", old_pwd);
        mParams.put("new_pwd", new_pwd);
        mParams.put("re_pwd", new_pwd);
        mParams.put("type", type);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.CHANGE_PWD);
    }

    public void clearCard(String iccid, String imsi, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("iccid", iccid);
        mParams.put("imsi", imsi);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.CLEAR_CARD);
    }

    /**
     * 获取短信中心号
     *
     * @param url
     * @param oneValue
     * @param twoValue
     * @param mStringCallback
     */
    public void startWriteCard(String url, String oneValue, String twoValue, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("id", oneValue);
        mParams.put("sn", twoValue);
        new HttpManage().postStringRequest(mParams, mStringCallback, url);
    }

    /**
     * 设备写卡成功,提交数据到服务器
     *
     * @param url
     * @param orderSn
     * @param iccid
     * @param mStringCallback
     */
    public void subWriteSuc(String url, String orderSn, String iccid, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("sn", orderSn);
        mParams.put("sim", iccid);
        new HttpManage().postStringRequest(mParams, mStringCallback, url);

    }

    //银行/支付宝账号
    public void EditBankAccount(String num, String bd_name, String pwd, String url, String touch_pwd, String touch_num, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("account", num);
        mParams.put("name", bd_name);
        mParams.put("pay_pwd", pwd);

        if (!TextUtils.isEmpty(touch_pwd))
            mParams.put("touch_pwd", touch_pwd);

        if (!TextUtils.isEmpty(touch_num))
            mParams.put("touch_num", touch_num);
        new HttpManage().postStringRequest(mParams, mStringCallback, url);
    }

    //解绑银行卡
    public void delBankAccount(String bank_card_id, String url, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("bank_card_id", bank_card_id);

        new HttpManage().postStringRequest(mParams, mStringCallback, url);
    }

    /**
     * 派单,完成订单
     *
     * @param orderSn
     * @param orderType
     * @param phoneNum
     * @param mStringCallback
     */
    public void finishOrder(String orderSn, String orderType, String phoneNum, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("order_sn", orderSn);
        mParams.put("order_type", orderType);
        mParams.put("phonenum", phoneNum);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.FINISH_ORDER);
    }

    /**
     * 派单,提交备注
     *
     * @param orderSn
     * @param remark
     * @param mStringCallback
     */
    public void subBeiZhu(String orderSn, String remark, StringCallback mStringCallback) {

        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("order_sn", orderSn);
        mParams.put("remark", remark);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.SUB_BEIZHU);
    }

    /**
     * 派单,退单
     *
     * @param note
     * @param orderSn
     * @param orderType
     * @param type
     * @param mStringCallback
     */
    public void tuiDan(String note, String orderSn, String orderType, int type, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("note", note);
        mParams.put("order_sn", orderSn);
        mParams.put("order_type", orderType);
        mParams.put("td_type", type + "");
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.TUI_DAN);
    }

    /**
     * 派单,转派
     *
     * @param orderSn
     * @param userName
     * @param mStringCallback
     */
    public void zhuaPai(String orderSn, String userName, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("order_sn", orderSn);
        mParams.put("user_name", userName);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.ZHUAN_PAI);
    }

    /**
     * 派单,预订
     *
     * @param phonenum
     * @param mStringCallback
     */
    public void yuDing(String phonenum, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("phonenum", phonenum);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.YU_DING);
    }

    /**
     * 获取首页派单数据
     *
     * @param search
     * @param mStringCallback
     */
    public void getPaiDanData(String search, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("action", "list");
        mParams.put("order_no", search);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.PAIDAN_URL + "get_order");
    }

    /**
     * 获取营销单
     *
     * @param typeOrder
     * @param ord
     * @param page
     * @param mStringCallback
     */
    public void getYingXiaoOrder(String typeOrder, String ord, int page, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("goods_name", typeOrder);
        mParams.put("order_no", ord);
        mParams.put("page", page + "");
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.YINGXIAO_ORDER);
    }

    /**
     * 派单,修改资料
     *
     * @param user_name
     * @param idcard
     * @param phonenum
     * @param order_sn
     * @param longitude
     * @param latitude
     * @param mStringCallback
     */
    public void editInfo(String user_name, String idcard, String phonenum, String order_sn,
                         double longitude, double latitude, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("user_name", user_name);
        mParams.put("idcard", idcard);
        mParams.put("phonenum", phonenum);
        mParams.put("order_sn", order_sn);
        mParams.put("long", longitude + "");
        mParams.put("lat", latitude + "");
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.EDIT_INFO);

    }

    /**
     * 派单,历史订单,取消/同步
     *
     * @param type
     * @param orderSn
     * @param orderType
     * @param mStringCallback
     */
    public void sureCancle(int type, String orderSn, String orderType, StringCallback mStringCallback) {

        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("type", type + "");
        mParams.put("order_sn", orderSn);
        mParams.put("order_type", orderType);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.TB_CANCLE);
    }

    public void getHistoryList(String data, String order_no, int orderType, String list, int page,
                               StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("date_type", data);
        mParams.put("order_no", order_no);
        mParams.put("type", orderType + "");
        mParams.put("action", "list");
        mParams.put("page", page + "");
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.HISTORY_LIST);
    }


    public void zwClose(String phone_brand, String phone_imei,
                        String phone_os, String phone_type,
                        String touch_pwd, String close, String pay_pwd, AbsCallback<String> mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        if (!TextUtils.isEmpty(close))
            mParams.put("close", close);

        if (!TextUtils.isEmpty(pay_pwd))
            mParams.put("pay_pwd", pay_pwd);

        mParams.put("phone_os", phone_os);
        mParams.put("phone_imei", phone_imei);
        mParams.put("phone_type", phone_type);
        mParams.put("phone_brand", phone_brand);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.ZHIWEN_KAIGUAN);
    }

    /**
     * PaiDanRemoteService 提交派单位置
     *
     * @param latitude
     * @param longitude
     * @param location
     * @param mStringCallback
     */
    public void getPaiDan(String latitude, String longitude, String location, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("Latitude", latitude);
        mParams.put("Longitude", longitude);
        mParams.put("action", location);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.PAIDAN_URL + "get_order");
    }

    /**
     * 转出
     *
     * @param type
     * @param money
     * @param pwd
     * @param touch_num
     * @param touch_pwd
     * @param url
     * @param mStringCallback
     */
    public void inOutMoney(String type, String money, String pwd, String touch_num, String touch_pwd, String url,
                           StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("cash_bank", "alipay");
        mParams.put("cash_money", money);
        mParams.put("pay_pwd", pwd);
        mParams.put("touch_num", touch_num);
        mParams.put("touch_pwd", touch_pwd);
        new HttpManage().postStringRequest(mParams, mStringCallback, url);
    }

    public void getZhuanZhang(StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_ZHUAN_ZHANG);
    }


    /**
     * 转出到账户
     *
     * @param content
     * @param money
     * @param pwd
     * @param touch_num
     * @param touch_pwd
     * @param user_name
     * @param mStringCallback
     */
    public void outAccount(String content, String money, String pwd, String touch_num, String touch_pwd, String user_name,
                           StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("content", content);
        mParams.put("money", money);
        mParams.put("pay_pwd", pwd);
        mParams.put("touch_num", touch_num);
        mParams.put("touch_pwd", touch_pwd);
        mParams.put("user_name", user_name);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.ZC_ZH);
    }

    /**
     * 宽带获取地址列表
     *
     * @param yewu_type       业务类型
     * @param addressQu       所选市
     * @param addressNum      地区编号
     * @param addressSearch   搜索词
     * @param mStringCallback
     */
    public void getKuanDaiLocation(String yewu_type, String addressQu, String addressNum, String addressSearch,
                                   StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("yewu_type", yewu_type);
        mParams.put("address_qu", addressQu);
        mParams.put("address", addressNum);
        mParams.put("name", addressSearch);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_KUANDAI_ADDRESS);
    }

    /**
     * 获取宽带套餐
     *
     * @param yewu_type       业务类型
     * @param mStringCallback
     */
    public void getKuanDaiTaoCan(String yewu_type, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("yewu_type", yewu_type);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_KUANDAI_TAOCAN);
    }

    /**
     * @param mUrl
     * @param isFzrName       是不是获取发展人名称
     * @param keyvalue        搜索词
     * @param developAdd      是获取发展人名称就要传归属渠道名称
     * @param mStringCallback
     */
    public void getFuJiaCanShu(String mUrl, boolean isFzrName, String keyvalue, String developAdd, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("keyvalue", keyvalue);
        if (isFzrName) {
            mParams.put("develop_addr", developAdd);
        }
        new HttpManage().postStringRequest(mParams, mStringCallback, mUrl);
    }

    /**
     * 获取宽带地区编号
     *
     * @param addressQu
     * @param mStringCallback
     */
    public void getDiQuNum(String addressQu, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("city", addressQu);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.GET_KUANDAI_DIQU_NUM);
    }

    /**
     * 转出
     */
    public void zhuanChu_zfb_yhk(String type, String money, String pwd, String touch_num, String touch_pwd, String url,
                                 StringCallback requestCallBack) {
        HashMap<String, String> mParams = new HashMap<>();

        mParams.put("cash_bank", type);
        mParams.put("cash_money", money);
        mParams.put("pay_pwd", pwd);
        mParams.put("touch_num", touch_num);
        mParams.put("touch_pwd", touch_pwd);
        new HttpManage().postStringRequest(mParams, requestCallBack, url);
    }

    /**
     * 转到用户
     */
    public void zhuanChuUser(String content, String money, String pay_pwd,
                             String touch_num, String touch_pwd, String user_name, String url,
                             StringCallback requestCallBack) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("content", content);
        mParams.put("money", money);
        mParams.put("pay_pwd", pay_pwd);
        mParams.put("touch_num", touch_num);
        mParams.put("touch_pwd", touch_pwd);
        mParams.put("user_name", user_name);

        new HttpManage().postStringRequest(mParams, requestCallBack, url);
    }

    /**
     * 提交宽带订单
     *
     * @param spec_id         套餐id
     * @param user_card       身份证号
     * @param iptv_sn         IPTV串码(可选影藏输入框)
     * @param house           报装地址补充
     * @param note            备注
     * @param gl_phone        关联号码(可选影藏输入框)
     * @param kuandai_phone   宽带帐号(可选影藏输入框)
     * @param phonenum        用户联系电话
     * @param photLists       客户照片总数量,根据 for循环"key"+i和"value"+i获取值
     * @param ditch_id        归属渠道id(隐藏值)
     * @param ditch_name      归属渠道名称(隐藏值)
     * @param sd_id           代收费发展商ID(隐藏值)
     * @param sd_name         代收费发展商(隐藏值)
     * @param cq_id           工单城区ID(隐藏值)
     * @param cq_name         工单城区(隐藏值)
     * @param whs_id          代维护商ID(隐藏值)
     * @param whs_name        代维护商(隐藏值)
     * @param address_id      地址ID(隐藏值)
     * @param address         报装地址
     * @param address_note    地址备注(隐藏值)
     * @param develop_id      发展人ID(隐藏值)
     * @param develop_name    发展人名称(隐藏值)
     * @param userTel         发展人手机
     * @param pay_pwd         支付密码
     * @param touch_pwd       指纹密码
     * @param touch_num       指纹随机数
     * @param mStringCallback
     */
    public void subDanKuanDaiOrder(String spec_id, String user_card, String iptv_sn, String house,
                                   String note, String gl_phone, String kuandai_phone, String phonenum,
                                   int photLists, String ditch_id, String ditch_name, String sd_id,
                                   String sd_name, String cq_id, String cq_name, String whs_id,
                                   String whs_name, String address_id, String address, String address_note,
                                   String develop_id, String develop_name, String userTel, String pay_pwd,
                                   String touch_pwd, String touch_num, String longitude, String latitude,
                                   String jzPhone, String kuandaiPhone, String kuandaiSim, String payamount,
                                   StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("spec_id", spec_id);
        mParams.put("icp_id", "1");
        mParams.put("tel", phonenum);
        mParams.put("user_card", user_card);
        mParams.put("iptv_sn", iptv_sn);
//        mParams.put("develop_addr", );
//        mParams.put("develop_info", );
//        mParams.put("three_agent", );
//        mParams.put("city_flag", );
//        mParams.put("agent_maint", );
        mParams.put("house", house);
        mParams.put("address", address);
        mParams.put("note", note);
        mParams.put("gl_phone", gl_phone);
        mParams.put("kuandai_phone", kuandai_phone);
        mParams.put("user_tel", userTel);

        mParams.put("ditch_id", ditch_id);
        mParams.put("ditch_name", ditch_name);
        mParams.put("sd_id", sd_id);
        mParams.put("sd_name", sd_name);
        mParams.put("cq_id", cq_id);
        mParams.put("cq_name", cq_name);
        mParams.put("whs_id", whs_id);
        mParams.put("whs_name", whs_name);
        mParams.put("address_id", address_id);
        mParams.put("address_note", address_note);
        mParams.put("develop_id", develop_id);
        mParams.put("develop_name", develop_name);

        // 用户上传的照片
        for (int i = 0; i < photLists; i++) {
            String key = PrefUtils.getString("key" + i, "");
            String value = PrefUtils.getString("value" + i, "");
            Log.e("项目异常", "key--value" + key + "-----" + value);
            mParams.put(key, value);
        }

        mParams.put("pay_pwd", pay_pwd);
        mParams.put("touch_pwd", touch_pwd);
        mParams.put("touch_num", touch_num);

        mParams.put("gps_e", longitude);
        mParams.put("gps_n", latitude);


        mParams.put("payamount", payamount);

        mParams.put("nr_phone", jzPhone);
        mParams.put("kuandai_phone", kuandaiPhone);
        mParams.put("kuandai_sim", kuandaiSim);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.SUB_KUANDAI_ORDER);
    }

    /**
     * 宽带提交办理
     *
     * @param ordSn
     * @param mStringCallback
     */
    public void kdTiJiaoBanLi(String ordSn, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("order_sn", ordSn);

        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.SUB_KUANDAI_ORDER_BANLI);
    }

    /**
     * 宽带获取IMSI
     *
     * @param iccid
     * @param phonenum
     * @param idcard
     * @param mStringCallback
     */
    public void getKuanDaiImsi(String iccid, String phonenum, String idcard, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("iccid", iccid);
        mParams.put("phonenum", phonenum);
        mParams.put("idcard", idcard);

        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.SUB_KUANDAI_GET_IMSI);
    }

    /**
     * 宽带提交写卡成功
     *
     * @param phonenum
     * @param idcard
     * @param procid
     * @param emptyCardId
     * @param imsi
     * @param cardData
     * @param iccid_no
     * @param mStringCallback
     */
    public void subKuanDaiWriteCard(String phonenum, String idcard, String procid, String emptyCardId,
                                    String imsi, String cardData, String iccid_no, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("phonenum", phonenum);
        mParams.put("idcard", idcard);
        mParams.put("procid", procid);
        mParams.put("emptyCardId", emptyCardId);
        mParams.put("imsi", imsi);
        mParams.put("cardData", cardData);
        mParams.put("iccid_no", iccid_no);

        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.SUB_KUANDAI_SUB_WRITE);
    }

    /**
     * 加款
     *
     * @param page
     * @param mStringCallback
     */
    public void jiakuan(int page, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("p", "" + page);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.ADD_MONEY_LIST);
    }


    /**
     * 意见反馈
     *
     * @param page
     * @param mStringCallback
     */
    public void feedBack(int page, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("p", "" + page);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.FEED_BACK);
    }


    /**
     * 意见反馈提交
     *
     * @param content
     * @param remark
     * @param mStringCallback
     */
    public void feedBackPost(String content, String remark, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("content", content);
        mParams.put("remark", remark);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.FEED_BACK_POST);
    }

    /**
     * 对账明细
     *
     * @param mStringCallback
     */
    public void duizhang(int page, String type, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("p", "" + page);
        if (type != null && !"".equals(type)) {
            mParams.put("log_type", "" + type);
        }
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.SZMX_LIST);
    }

    /**
     * 转出记录
     *
     * @param mStringCallback
     */
    public void zhuanchu(int page, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("p", "" + page);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.ZC_LIST);
    }

    /**
     * 公告列表
     *
     * @param page
     * @param mStringCallback
     */
    public void getGongGaoData(String page, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("page", "" + page);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.FIND_PTGG);
    }

    /**
     * 副卡检测
     *
     * @param keyvalue
     * @param mStringCallback
     */
    public void checkFuKa(String keyvalue, StringCallback mStringCallback) {
        HashMap<String, String> mParams = new HashMap<>();
        mParams.put("main_phone", keyvalue);
        new HttpManage().postStringRequest(mParams, mStringCallback, GlobalUrls.CHECK_FUKA);
    }
}
